/*
 * @Author: your name
 * @Date: 2020-10-31 01:07:04
 * @LastEditTime: 2020-11-30 16:50:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \profess-baidu-2\packageB\pages\want2\want2.js
 */
const app = getApp();
Page({
    data: {
        professRecordEntity:{}
    },
    toNext() {
        swan.request({

            url:app.globalData.URL + `/8100/profess-record/updateStatusById/${this.data.professRecordEntity.professRecord.id}/3`,
            method: 'put',
            success:res=>{

                if(res.data.code != 200){
                    app.showToastFail(res.data.msg)
                    return;
                }
            }
        })

        swan.navigateTo({
            url: `/packageB/pages/chat/chat?toUserId=${this.data.professRecordEntity.from.id}`
        });
    },
    onLoad: function () {
        // 监听页面加载的生命周期函数

        let professRecordId = app.cache.get('professRecordId')
        swan.request({
            url:app.globalData.URL + `/8100/profess-record/findEntityById/${professRecordId}`,
            method: 'get',
            success:res=>{

                if(res.data.code != 200){
                    app.showToastFail(res.data.msg)
                    return;
                }
                console.log(res);
                this.setData({
                    professRecordEntity: res.data.data
                })
            }
        })
    }
});